package com.liveinstars.im.common.enums;

import com.onepiece.shipelves.common.Result;
import com.onepiece.shipelves.common.enums.BaseExceptionEnum;
import lombok.Getter;

/**
 * @author: zhouze
 * @date: 2020/3/26
 */
@Getter
public enum IMExceptionEnum implements BaseExceptionEnum {
    //007 IM异常
    GOLD_IS_NOT_ENOUGH("20070000","可用金币不足！"),
    GET_CANDY_REPEAT("20070000", "请勿重复抢红包！"),
    CANDY_TYPE_ERROR("20070000", "币种类型异常！"),
    CANDY_CREATE_ERROR("20070000", "红包创建失败！"),
    CANDY_NUM_LESS_THEN_USER_NUM("20070000", "金币数小于红包数"),
    BAD_WORDS_ERROR("20070000", "内容含敏感词请重新输入"),
    
    //007100 消息发送异常
    FAIL_FRIEND_SHIELD("20071001", "发送失败，好友被屏蔽"),
    FAIL_TEMP_SHIELD("20071002", "发送失败，临时关系被屏蔽"),
    FAIL_NOT_MEMBER("20071003", "发送失败，不是圈子成员"),
    FAIL_BESHIELD("20071004", "发送失败，被禁言"),
    FAIL_CHAT_GROUP_DISBAND("20071005", "发送消息失败，群被解散了"),
    FAIL_CHAT_SERVER_ERROR("20071006", "消息服务器异常"),
    FAIL_CHAT_MESSAGE("20071007", "消息发送失败"),

    //0072 用户相关
    USER_IS_NOT_EXIST("20070000", "用户不存在！"),
    //0073 圈子相关
    CHAT_GROUP_NAME_IS_EMPTY("20070000", "群组名不能为空！"),
    CHAT_GROUP_NAME_REPEAT("20070000", "圈子名称有重名！"),
    CHAT_GROUP_CREATE_ONLY_ONE("20070000", "圈子一个人目前只能创建一个！"),
    CHAT_GROUP_MANAGER_CAN_NOT_SHIELD("20070000", "管理员不能被禁言!"),
    CHAT_GROUP_IS_NOT_EXIST("20070000", "圈子不存在！"),
    CHAT_GROUP_DISBAND_PERMISSION_DENIED("20070000", "没有权限解散！"),
    CHAT_GROUP_OPERATION_PERMISSION_DENIED("20070000", "没有操作权限！"),
    CHAT_GROUP_LACK_OPERATION_USER("20070000", "缺少操作用户"),
    CHAT_GROUP_MEMBER_IS_NOT_EXIST("20070000", "圈子用户不存在！"),
    CHAT_GROUP_JOIN_LEVEL_NOT_ALLOW("20070000", "等级不符合加入要求"),
    CHAT_GROUP_JOIN_USER_IS_EXIST("20070000", "加圈用户已存在！"),
    CHAT_GROUP_JOIN_TODO_IS_EXIST("20070000", "请勿重复加圈！"),
    CHAT_GROUP_JOIN_LIMIT("20070000", "圈人数超过上限！"),

    //0074 好友相关
    FRIEND_TEMP_IS_NOT_EXIST("20070000", "临时好友不存在！"),
    FRIEND_JOIN_USER_IS_EXIST("20070000", "好友已存在！"),
    FRIEND_JOIN_TODO_IS_EXIST("20070000", "请勿重复申请好友请求！"),

    //0075 TODO相关
    TODO_DEAL_WITH_IS_REPEAT("20070000", "处理请求重复！"),
    TODO_DEAL_TYPE_ERROR("20070000", "代办事项类型异常"),
    TODO_DEAL_IS_NOT_EXIST("20070000", "该代办事项不存在！")
    ;

    private String code;

    private String message;

    IMExceptionEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }


    @Override
    public Result createResult() {
        Result result = new Result();
        result.setCode(this.code);
        result.setMessage(this.message);
        return result;
    }

    @Override
    public String getExceptionCode() {
        return this.getCode();
    }

    @Override
    public String getExceptionMessage() {
        return this.getMessage();
    }
}
